/*#include<stdio.h>
int main()
{
	long n;
	scanf("%ld",&n);
	long a[n];
	if(a<3)
	printf("1");
	else
	{
		a[0]=a[1]=1;
		long i;
		for(i=2;i<n;i++)
		a[i]=a[i-1]+a[i-2];
		printf("%ld",a[n-1]%10007);
	}
	return 0;
}*/
#include <stdio.h>

int main() 
{
    int n;
    scanf("%d", &n);
    int a = 1, b = 1, c,i;
    for (i = 3; i <= n; i++) 
	{
        c = (a + b) % 10007;
        a = b;
        b = c;
    }
    if (n == 1 || n == 2) 
	{
        printf("1\n");
    }
	 else 
	{
        printf("%d\n", c);
    }

    return 0;
}
